package XueXi;

import java.util.Scanner;

public class Break_jieshuLX {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String name = "";
        String passwd = "";
        int chance = 3;
        for (int i = 1;i <= chance;){
            System.out.println("请输入名字");
            name = scanner.next();
            System.out.println("请输入密码");
            passwd = scanner.next();
            //比较输入名字和密码是否正确
            //字符串的比较方法 equals
            if ("丁真".equals(name)&&"666".equals(passwd)){
                System.out.println("恭喜你，登录成功！");
                break;
            }else{
                    chance--;
                    if (chance!=0){
                System.out.println("您还有"+chance+"次机会");
                    }else{
                        System.out.println("您的账号已锁！！！");
                    }
               }

        }
    }
}
